package com.hospital.doctor.doctory.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hospital.doctor.doctory.dao.PatientDiagnosisResultsMapper;
import com.hospital.doctor.doctory.entity.PatientDiagnosisResults;
import com.hospital.doctor.doctory.service.PatientDiagnosisResultsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author ：ysb
 * @ClassName ：PatientDiagnosisResultsServiceImpl
 * @Package ：com.hospital.doctor.doctory.service.impl
 * @Description:
 * @Date:2021/11/17 16:45
 */
@Service
public class PatientDiagnosisResultsServiceImpl implements PatientDiagnosisResultsService {

    @Autowired
    private PatientDiagnosisResultsMapper patientDiagnosisResultsMapper;
    @Override
    public boolean insertRecords(PatientDiagnosisResults patientDiagnosisResults) {
        int insert = patientDiagnosisResultsMapper.insert(patientDiagnosisResults);
        return insert==1;
    }

    @Override
    public List<PatientDiagnosisResults> selectByPatientId(String doctorid) {
        QueryWrapper<PatientDiagnosisResults> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("doctorid",doctorid);
        queryWrapper.orderByDesc("time");
        return patientDiagnosisResultsMapper.selectList(queryWrapper);
    }
}
